package com.hangxiang.approval.controller;

import com.hangxiang.approval.common.ActioncolumnInsertCommon;
import com.hangxiang.approval.common.ActioncolumnUpdateCommon;
import com.hangxiang.approval.common.IntegerCommon;
import com.hangxiang.approval.common.ResultBean;
import com.hangxiang.approval.service.ActioncolumnService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (Actioncolumn)表控制层
 *
 * @author makejava
 * @since 2020-11-25 11:28:24
 */
@RestController
@RequestMapping("actioncolumn")
@Api(tags = "角色菜单相关功能")
public class ActioncolumnController {
    /**
     * 服务对象
     */
    @Resource
    private ActioncolumnService actioncolumnService;

    /**
     * 通过主键查询单条数据
     *
     * @param common 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    @ApiOperation(value = "通过主键查询单条数据")
    @ResponseBody
    public ResultBean selectOne(@RequestBody @Validated IntegerCommon common) {
        return ResultBean.success(actioncolumnService.queryById(common));
    }

    /**
     * 新增数据
     *
     * @param actioncolumnInsertCommon 实例对象
     * @return 实例对象
     */
    @PostMapping("insertActioncolumn")
    @ApiOperation(value = "添加数据")
    @ResponseBody
    public ResultBean insertActioncolumn(@RequestBody @Validated ActioncolumnInsertCommon actioncolumnInsertCommon) {
        return ResultBean.success(actioncolumnService.insertActioncolumn(actioncolumnInsertCommon));
    }

    /**
     * 新增数据
     *
     * @param actioncolumnUpdateCommon 实例对象
     * @return 实例对象
     */
    @PostMapping("updateActioncolumn")
    @ApiOperation(value = "修改数据")
    @ResponseBody
    public ResultBean updateActioncolumn(@RequestBody @Validated ActioncolumnUpdateCommon actioncolumnUpdateCommon) {
        return ResultBean.success(actioncolumnService.updateActioncolumn(actioncolumnUpdateCommon));
    }


}